﻿<Window x:Class="UmlControlLibrary.UmlPropertyProperties"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:MyControl="clr-namespace:UmlControlLibrary"
    Title="{Binding Path=ElementLabel, Mode=TwoWay}" ResizeMode="NoResize" WindowStyle="SingleBorderWindow" AllowsTransparency="False" Opacity="1" Visibility="Visible" WindowStartupLocation="CenterScreen" Background="WhiteSmoke" SizeToContent="WidthAndHeight" Width="693" Height="567">
    <Window.Resources>
        <!-- Provider for Property modifiers enum+label list (Public / Private / Protected)-->
        <ObjectDataProvider x:Key="PropertyModifiers" MethodName="GetPropertyModifiers" ObjectType="{x:Type MyControl:UmlModifierItem}" />

        <!-- Provider for Types list -->
        <ObjectDataProvider x:Key="Types" MethodName="GetTypesList" ObjectType="{x:Type MyControl:UmlModel}" />
    
        <DataTemplate DataType="{x:Type MyControl:UmlClass}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/Images/class.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />
            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlInterface}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/Images/interface.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />
            </StackPanel>
        </DataTemplate>

        <DataTemplate DataType="{x:Type MyControl:DiagramElement}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/Images/class.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />
            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlProperty}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/Images/attribute.png"/>
                <TextBlock Text="{Binding Path=ElementName}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlType}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/Images/datatype.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlRelation}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/Images/Arrow.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlRelationEnd}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/Images/Arrow.png"/>
                <TextBlock Text="{Binding Path=Text}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>


    </Window.Resources>
   
    <StackPanel>
<!--    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="45" />
            <RowDefinition Height="45" />
            <RowDefinition Height="45" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions -->
        <GroupBox Header="General" Name="gbGeneral" >
            <!-- Modifier, Property Name, property Type -->
            <StackPanel Orientation="Horizontal">
                <!-- Property Modifier Combo. Get items from PropertyModifiers -->
                <ComboBox ItemsSource="{Binding Source={StaticResource PropertyModifiers}}"
                    DisplayMemberPath="Label"
                    SelectedValuePath="Modifier"
                    IsSynchronizedWithCurrentItem="True"
                    SelectedValue="{Binding Path=Modifier, Mode=TwoWay}" Width="105" />
                <!-- Property Name -->
                <TextBox Text="{Binding Path=ElementName, Mode=TwoWay}" LostFocus="PropertyContextMenu_TextBox_LostFocus" Width="175" />
                <!-- Property Type Combo. Get items from Types-->
                <!--ItemsSource="{Binding Source={StaticResource Types}}"-->
<!--                    SelectedValuePath="Name"
                    IsSynchronizedWithCurrentItem="True"
                    
                    Background="White"
                    SelectedValue="{Binding Path=TypeName, Mode=TwoWay}" 

                LostFocus="PropertyContextMenu_TextBox_LostFocus" 
                    Text="{Binding Path=TypeName, Mode=TwoWay}"
-->
                <ComboBox Name="TypeCombo"
                    IsEditable="True"
                    StaysOpenOnEdit="True"                   
                    Width="300"
                    SelectionChanged="TypeCombo_SelectionChanged"
                    
                 >
                    <!--TreeView ItemsSource="{Binding Source={StaticResource Types}}" /-->
                    <MyControl:UmlTree x:Name="TypeTreeView" Height="300" Width="300" TreeViewItem.Selected="UmlTreeView_Selected" />
                </ComboBox>
            </StackPanel>
        </GroupBox>
        <StackPanel Name="wrapPanel1" Orientation="Horizontal" HorizontalAlignment="Right"  VerticalAlignment="Bottom" Height="23" Width="150">
            <Button Height="23" Name="btnOK" Width="75" IsDefault="True" Click="btnOK_Click">OK</Button>
            <Button Height="23" Name="btnCancel" Width="75" IsCancel="True">Cancel</Button>
        </StackPanel>
        <Expander Header="Advanced" IsExpanded="False">
            <StackPanel>
                <GroupBox Header="Stereotype" Name="gbStereotype" >
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBox Text="{Binding Path=StereoType, Mode=TwoWay}" Width="353" />
                        </StackPanel>
                    </StackPanel>
                </GroupBox>
                <GroupBox Header="Derivation" Name="gbDerivation" >
                    <StackPanel Orientation="Horizontal" >
                        <Label Content="Expression :" Margin="0 -2 0 0" />
                        <TextBox Text="{Binding Path=DerivationExpression, Mode=TwoWay}" LostFocus="PropertyContextMenu_TextBox_LostFocus" Width="353" />
                    </StackPanel>
                </GroupBox>
                <MyControl:SyntaxBoxTabControl x:Name="CustomCode" Height="348" Width="668" />
            </StackPanel>
        </Expander>
        <!--/Grid-->       
    </StackPanel>        
</Window>
